package com.wuzao.BridgePattern;

import com.wuzao.BridgePattern.devices.Device;
import com.wuzao.BridgePattern.devices.Radio;
import com.wuzao.BridgePattern.devices.Tv;
import com.wuzao.BridgePattern.remotes.AdvancedRemote;
import com.wuzao.BridgePattern.remotes.BasicRemote;

/**
 * 桥接模式
 */
public class Demo {

        public static void main(String[] args) {
            testDevice(new Tv());
            testDevice(new Radio());
        }

        public static void testDevice(Device device) {
            System.out.println("Tests with basic remote.");
            BasicRemote basicRemote = new BasicRemote(device);
            basicRemote.power();
            device.printStatus();

            System.out.println("Tests with advanced remote.");
            AdvancedRemote advancedRemote = new AdvancedRemote(device);
            advancedRemote.power();
            advancedRemote.mute();
            device.printStatus();
        }

}
